package com.chang.multithread;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class StartOrRun {
    public static void main(String[] args) {

    Thread t1=new Thread("t1"){
        @Override
        public void run() {
            int sum=0;
            for (int i = 0; i <100 ; i++) {
                sum+=i;
            }
            System.out.println("sum="+sum);
            log.debug("running!");    //非主线程
        }
    };
    //t1.run();
    t1.start();  //start方法只能被调用一次
    log.debug("do OtherThings");   //主线程

        /*System.out.println(t1.getState());  //新建状态
        t1.start();
        System.out.println(t1.getState());  //可运行状态*/
    }

}
